package presentation;

import java.util.Observable;

import control.CControl;

public class PTextValue extends PValue {
	private String unit = "";
	
	public PTextValue(CControl cControl, String register) {
		cControl.addRegisterObserver(register, this);
		unit = cControl.getRegisterUnit(register);
	}
	
	@Override
	public void update(Observable obj, Object arg) {
		if (arg instanceof Number) {
			if (unit.equalsIgnoreCase("")) {
				this.value = ((Number) arg).toString();
			} else {
				this.value = ((Number) arg).toString() + " " + unit;
			}
			
        }
	}
}
